#include"verilated.h"
#include"Vtop.h"
#include"stdio.h"
#include"stdlib.h"
#include"assert.h"
#include"verilated_vcd_c.h"
#include"nvboard.h"

static TOP_NAME dut;
static Vtop* top;
void nvboard_bind_all_pins(Vtop* top);

void step_and_dump_wave(){
	nvboard_update();
	top->eval();
}


void sim_init(){
	nvboard_init();
	top = new Vtop;
}

void sim_exit(){
	step_and_dump_wave();
}



int main(){
	nvboard_bind_all_pins(&dut);
	sim_init();
	while(1){
		int a = rand() & 1;
		int b = rand() & 1;
		top->a = a;
		top->b = b;
		step_and_dump_wave();
		printf("a=%d ,b=%d,f=%d\n",a,b,top->f);
		assert(top->f == a ^ b);}
	delete top;
	nvboard_quit();
}

